package com.song.enums;

import com.song.annotation.EnumValidate;

public enum GenderEnum implements BaseEnum<String> {
    FMALE("0", "女"),
    MALE("1", "男")
    ;
    private String code;
    private String desc;

    GenderEnum(String code, String desc){
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String getCode() {
        return this.code;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }

    public static String getGenderCode(String desc){
        for (GenderEnum genderEnum : values()) {
            if (genderEnum.getDesc().equals(desc)){
                return genderEnum.getCode();
            }
        }
        return "";
    }

    public static String getGenderDesc(String code) {
        for (GenderEnum genderEnum : values()) {
            if (genderEnum.getCode().equals(code)){
                return genderEnum.getDesc();
            }
        }
        return "";
    }
}
